package com.ruoyi.sevenInterfaces.utils;

import java.util.Random;

/**
 * @Description TODO
 * @Author wsl
 * @Date 2025-02-21 20:53
 * @Version 1.0
 */

public class IdUtils {

    public static long generateId() {
        //取当前时间的长整形值包含毫秒
        long millis = System.currentTimeMillis();
        //加上两位随机数
        Random random = new Random();
        int end2 = random.nextInt(99);
        //如果不足两位前面补0
        String str = millis + String.format("%02d", end2);
        long id = new Long(str);
        return id;
    }

    public static void main(String[] args) {
        long l = IdUtils.generateId();
        System.out.println(l);
    }



}
